﻿<%@ Page Language="C#" MasterPageFile="~/home-loan/Home_Loan_Result.master" AutoEventWireup="true"
    CodeFile="results.aspx.cs" Inherits="home_loan_results" MaintainScrollPositionOnPostback="true"
    Async="true" %>

<%@ Register Src="~/controls/usrNoJS.ascx" TagName="usrNoJS" TagPrefix="ucNoJS" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/controls/usrPhoneNo.ascx" TagName="usrPhoneNo" TagPrefix="uc1" %>
<%@ Register Src="../controls/usrIdNumber.ascx" TagName="usrIdNumber" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=90);
            opacity: 0.8;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="../css/forms_results.css" />
    <link rel="stylesheet" type="text/css" href="../css/button.css" />

    <script src="../includes/ValidationError-NEW.js" type="text/javascript"></script>

    <script src="../includes/ValidationEffect-NEW.js" type="text/javascript"></script>

    <asp:ScriptManager ID="ScriptManager" runat="server">
    </asp:ScriptManager>
    <div class="elements_inner_wrapper">
        <ucNoJS:usrNoJS ID="usrNoJS1" runat="server" />
        <!-- #Include file="../includes/body_loader.inc" -->

        <script type="text/javascript">
            IncreaseProgress(10);
        </script>

        <div id="divContent" style="display: none;">
            <div id="contentBody_full">
                <div class="form_selection" id="divFormSelection" runat="server">
                    <div class="selection_wrap">
                        <span class="fs_lbl">Mortage Type : </span>
                        <asp:Label ID="lblMortageType" class="fs_lbl_m" runat="server" />
                        <span class="fs_lbl_r">Property Type : </span>
                        <asp:Label ID="lblPropertyType" class="fs_lbl_m" runat="server" />
                        <span class="fs_lbl_r">Loan Amount : </span>
                        <asp:Label ID="lblLoanAmount" class="fs_lbl_m" runat="server" />
                        <%--<span class="fs_lbl_r">Type of Interest: </span>
                        <asp:Label ID="lblInterestType" runat="server" class="fs_lbl_m" />
                        <span class="fs_lbl_r">Lock In : </span>
                        <asp:Label ID="lblLockIn" class="fs_lbl_m" runat="server" />--%>
                    </div>
                    <br />
                </div>
                <div>
                    <!-- Steps | Start
                    <ul id="stp_menu">
                        <li class="stp1_r"><a href="#"><span class="stp_r_g">Start Quote</span></a></li>
                        <li class="stp2_r"><a href="#"><span class="active_r">Quote Results</span></a></li>
                        <li class="stp3"><a href="#"><span class="stp_r">Buy Now</span></a></li>
                    </ul>
                </div>
                Steps | End   -->
                    <div class="seperator">
                    </div>

                    <script type="text/javascript">
                        IncreaseProgress(20);
                    </script>

                    <div style="width: 100%; height: auto; text-align: right; display: none;" id="divHeadingbuydirect"
                        runat="server">
                        <asp:Image ImageUrl="~/images/bg/heading_buydirect.png" runat="server" ID="imgInstantBuy" /></div>
                    <div style="width: 964px; text-align: right;">
                        <asp:ImageButton runat="server" ID="imgbtnCompare" OnClientClick="if (Validate_Checkbox()) { ShowPopupLearnMore(); return false;} else { return false; }"
                            ImageUrl="~/images/button/xl/select-enquire_single.png" OnClick="imgbtnCompare_Click" />
                    </div>
                    <div class="seperator_hilite_2 right">
                    </div>
                    <br />

                    <script type="text/javascript">
                        IncreaseProgress(30);
                    </script>

                    <asp:GridView ID="gvHLResults" runat="server" AutoGenerateColumns="False" CellPadding="0"
                        GridLines="None" DataKeyNames="HLTempID,ProviderCompanyID" EmptyDataText="<div class='pad_10 left' style='text-align:left;'><h2>No Matches Found!</h2><span class='font_12'><strong>Please take note that there are no matches found based on your details entered.</strong></span><div class='seperator'></div><div class='seperator'></div>You can also return to our <a href='/'>homepage</a> or our dedicated <a href='/home-loan/'>Home Loans</a> page to re-quote.<div class='seperator'></div>Thank you for using CompareXpress.com.</div>"
                        EmptyDataRowStyle-CssClass="" AllowSorting="True" OnRowDataBound="gvHLResults_RowDataBound"
                        CssClass="table_results" ShowFooter="true">
                        <Columns>
                            <asp:BoundField DataField="HLTempID" InsertVisible="False" ReadOnly="True" Visible="False">
                                <ItemStyle Width="0px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="ProviderCompanyID" InsertVisible="False" ReadOnly="True"
                                Visible="False">
                                <ItemStyle Width="0px" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="No." HeaderStyle-CssClass="title_l_s2">
                                <ItemTemplate>
                                    <div>
                                        <asp:Label ID="lblPackageNo" runat="server" Text="" />
                                    </div>
                                </ItemTemplate>
                                <ItemStyle CssClass="col_l_s border2pxl_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <%--<asp:TemplateField HeaderText="Package" HeaderStyle-CssClass="title_l_s">
                                <ItemTemplate>
                                    <div>
                                        <asp:Label ID="lblPackageName" runat="server" Text="" />
                                    </div>
                                </ItemTemplate>
                                <ItemStyle CssClass="col_l_s border2pxl_grey border1pxb_grey" />
                            </asp:TemplateField>--%>
                            <asp:TemplateField HeaderText="Total Interest<br/>(3 years)" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblTotalInterest" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="colprice_s_purple border1pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Year 1 Monthly Repayments" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblYear1MonthlyPayment" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="colprice_s border1pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Year 2 Monthly Repayments" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblYear2MonthlyPayment" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="colprice_s border1pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Year 3 Monthly Repayments" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblYear3MonthlyPayment" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="colprice_s border1pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Thereafter Monthly Repayments" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblYear4MonthlyPayment" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="col_r_s border2pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Lock In" HeaderStyle-CssClass="title_price_s">
                                <ItemTemplate>
                                    <asp:Image runat="server" ID="imgLockInStatus" />
                                    <asp:Label ID="lblLockInPeriod" runat="server"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="col_r_s border2pxr_grey border1pxb_grey" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-CssClass="title_r_select" HeaderText="ENQUIRE">
                                <ItemStyle CssClass="col_select border2pxr_grey" />
                                <ItemTemplate>
                                    <div onmouseover="this.className='col_select_hover border2pxr_grey'" onmouseout="this.className='col_select border2pxr_grey'"
                                        style="width: 100%; height: 100%; vertical-align: middle;" id="divcbHomeLoan"
                                        runat="server">
                                        <div style="padding-top:40px;">
                                            <asp:CheckBox ID="cbHLSelect" runat="server" onclick="if (this.checked) return checkMaxBox(this, id); else boxesChecked--;unCheckBox(id);  " /><asp:Label
                                                runat="server" ID="lblTempId" Visible="false"></asp:Label>
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <%--<asp:TemplateField HeaderText="Learn more" HeaderStyle-CssClass="title_r">
                            <ItemTemplate>
                                <asp:Button ID="btnLearnMore" runat="server" CommandName="LearnMore" class="button_learn-more"
                                    onmousedown="this.className = 'button_learn-more_mousedown';" onmouseup="this.className = 'button_learn-more';"
                                    onmouseout="this.className = 'button_learn-more';" />
                            </ItemTemplate>
                            <ItemStyle CssClass="col_r border2pxr_grey border1pxb_grey" />
                        </asp:TemplateField>--%>
                        </Columns>
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="header" />
                        <EditRowStyle />
                        <RowStyle CssClass="row" />
                        <FooterStyle CssClass="row_last" />
                    </asp:GridView>
                    
                    <div style="width:964px; text-align:right;">
<img src="../images/form/bg_result-header_colmargin_up.png" alt=""  style="padding-right:29px;" /><br/>
                        <asp:ImageButton runat="server" ID="imgbtnCompare2" OnClientClick="if (Validate_Checkbox()) { ShowPopupLearnMore(); return false;} else { return false; }"
                            ImageUrl="~/images/button/xl/select-enquire_single.png" OnClick="imgbtnCompare_Click" /></div>
                    <div class="seperator">
                    </div>
                    <div class="seperator_dashed center" style="width:975px;">
                    </div>
                    <div style="font-size:12px; width:954px; text-align:center; padding:15px; background:#eaeaea;">
                    <strong>Important Information</strong>: Some lenders will only update rate changes into effect until the end of the month, some of the rates shown here may still reflect older rates.
                    </div>
                    <script type="text/javascript">
                        IncreaseProgress(50);
                    </script>

                    <div class="seperator">
                    </div>
                    <%--<div style="padding: 15px; border: 1px solid #d1d1d1; background: #eeeeee; line-height: 35px;">
                    <div class="blacklbl">
                        <h1>
                            Important Notes:</h1>
                    </div>
                    <div class="blacksmall" style="color: #313131">
                        • The amounts listed in the benefits table are the maximum coverage payable for
                        each benefit.<br />
                        • Coverage intended for overseas traveling and not in Singapore. Insured person
                        must be Singaporean or Singapore Permanent Resident only.<br />
                        • Information displayed here is a summary. Please refer to the actual policy wordings
                        (click on respective “View Policy” button) for details of coverage.
                    </div>
                </div>--%>
                    <div class="seperator">
                    </div>
                    <div class="formButtons">
                        <div class="cancel">
                            <span class="button2">
                                <asp:Button runat="server" ID="ibtnBack" onmousedown="this.className = 'button_back_mousedown';"
                                    onmouseout="this.className = 'button_back';" CssClass="button_back" OnClientClick="if (Page_ClientValidate('none')){this.removeAttribute('onmouseout'); this.removeAttribute('onmouseup'); this.className = 'button_processing';} return true;"
                                    OnClick="ibtnBack_Click" />
                            </span>
                        </div>
                    </div>

                    <script type="text/javascript">
                        IncreaseProgress(75);
                    </script>

                    <div>
                        <div style="display: none;">
                            <asp:LinkButton runat="server" ID="lnkbtnPopup" Text="click"></asp:LinkButton>
                            <%--<input id="inputProviderId" runat="server" type="hidden" />
                        <input id="inputTAId" runat="server" type="hidden" />
                        <input id="inputPlanType" type="hidden" runat="server" />
                        <input id="inputPlanName" type="hidden" runat="server" />
                        <input id="inputPremium" type="hidden" runat="server" />
                        <input id="inputResultId" type="hidden" runat="server" />
                        <input id="inputUserId" type="hidden" />--%>
                        </div>
                        <cc1:ModalPopupExtender ID="mpePopup" runat="server" DropShadow="true" PopupControlID="pnlPopup"
                            BackgroundCssClass="modalBackground" TargetControlID="lnkbtnPopup" CancelControlID="btnClose"
                            BehaviorID="mdlPopupLearnMore">
                        </cc1:ModalPopupExtender>
                        <!-- Learn More Popup | Start -->
                        <asp:Panel ID="pnlPopup" runat="server" Style="display: none; background: white;"
                            Width="595px" Height="355px">
                            <div id="divPopup" style="padding: 10px; padding-top: 0px; height: 365px;">
                                <div style="width: 100%; height: 30px; text-align: right; margin-top: 3px;">
                                    <div class="left" style="font-size:12px; color:#1e95c4; padding:13px 0 0 13px;">
                                    <strong>Note</strong>: Learn more about selected packages from bank representatives directly. 
                                    </div>
                                    <div class="bg_grey_5 pad7px txtright" style="width: 560px; text-align: right;">
                                        <a href="#" name="ctl00$ContentPlaceHolder1$btnClose" onclick="HidePanelLearnMore();"
                                            id="A1">
                                            <img src="/images/spacer.gif" id="btnClose" border="0" class="button_close" width="75"
                                                height="30" alt="Close" /></a>
                                    </div>
                                </div>
                                <div class="seperator_15px">
                                </div>
                                <div class="seperator_15px">
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" class="table_details" style="width: 580px;">
                                    <tr>
                                        <td width="220">
                                        </td>
                                        <td class="bg_grey_2" width="360">
                                            <div>
                                                <div class="curvetopleft left">
                                                </div>
                                                <div class="curvetopright right">
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="txtleft pad7px border1pxdotb_light">
                                            <strong>Your Name</strong>
                                        </td>
                                        <td class="bg_grey_2 pad7px border2pxdotb">
                                            <asp:TextBox ID="txtFullName" Width="250" MaxLength="80" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="rfvFullName" runat="server" ControlToValidate="txtFullName"
                                                CssClass="validationErrorControl" ErrorMessage="" ValidationGroup="homeloan"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ID="revFullName" runat="server" ValidationGroup="homeloan"
                                                ValidationExpression="^[a-zA-Z''-'\s]{1,80}$" CssClass="validationErrorControl"
                                                ControlToValidate="txtFullName" ErrorMessage=""></asp:RegularExpressionValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="txtleft pad7px border1pxdotb_light">
                                            <strong>Your E-mail</strong>
                                        </td>
                                        <td class="bg_grey_2 pad7px border2pxdotb">
                                            <asp:TextBox ID="txtEmail" runat="server" Width="250" MaxLength="100"></asp:TextBox>
                                            <br />
                                            <p style="font-size: smaller;">
                                                View
                                                <asp:HyperLink runat="server" ID="hplViewPrivacy" Text="Privacy Policy" Target="_blank"
                                                    NavigateUrl="~/privacy/" />
                                                <asp:RequiredFieldValidator ID="rfvEmail" CssClass="validationErrorControl"
                                                    runat="server" ValidationGroup="homeloan" ErrorMessage="" Text="" ControlToValidate="txtEmail"
                                                    Display="Dynamic"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator CssClass="validationErrorControl" ID="cxvEmail"
                                                    runat="server" ValidationGroup="homeloan" ErrorMessage="" Text="" ControlToValidate="txtEmail"
                                                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:RegularExpressionValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="txtleft pad7px border1pxdotb_light">
                                            <strong>Your Mobile Number</strong>
                                        </td>
                                        <td class="bg_grey_2 pad7px border2pxdotb">
                                            <uc1:usrPhoneNo ID="txtMobileNo" IsEnabled="true" IsRequired="true" PhoneNoRequireErrorMessage="Require mobile number."
                                                PhoneNoErrorMessage="Mobile phone number should 8 digits." PhoneNoValidErrorMessage="Invalid mobile phone number."
                                                runat="server" ValidationGroup="homeloan" />
                                        </td>
                                    </tr>
                                    <%--<tr id="trYourNRIC" style="display: none;">
                                    <td class="txtleft pad7px border1pxdotb_light">
                                        <strong>Your NRIC</strong>
                                    </td>
                                    <td class="bg_grey_2 pad7px border2pxdotb">
                                        <uc2:usrIdNumber ID="usrNRIC" runat="server" ValidationGroup="homeloan" />
                                    </td>
                                </tr>--%>
                                    <tr>
                                        <td class="txtleft pad7px">
                                            &nbsp;
                                        </td>
                                        <td class="bg_grey_2 pad7px">
                                            <asp:Button runat="server" ID="btnSubmit" onmousedown="this.className = 'button_submit_mousedown';"
                                                onmouseup="this.className = 'button_submit';" onmouseout="this.className = 'button_submit';"
                                                CssClass="button_submit" OnClick="btnSubmit_Click" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('homeloan')){this.removeAttribute('onmouseout');this.removeAttribute('onmouseup');this.className = 'button_processing';}"
                                                ValidationGroup="homeloan" />
                                            <div runat="server" id="divPopUpMessage" visible="false">
                                                <br />
                                                <asp:Label runat="server" Font-Bold="true" ForeColor="Red" ID="lblPopUpMessage" runat="server" />
                                            </div>
                                            <div id="divdisclaimer" style="width: 320px; font-size: 0.85em; margin: 0 auto; text-align: justify;
                                                padding: 7px;">
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td class="bg_grey_2 w210px">
                                            <div>
                                                <div class="curvebottomleft left">
                                                </div>
                                                <div class="curvebottomright right">
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                        <!-- Learn More Popup | End   -->
                    </div>
                </div>
            </div>
        </div>

        <script type="text/javascript">
            IncreaseProgress(80);
        </script>

        <script type="text/javascript">

            function Validate_Checkbox() {
                var minCheck = 1;
                var NoOfChecks = 0;
                var chks = document.getElementsByTagName('input');
                var retValue = true;
                //var hasChecked = false;
                for (var i = 0; i < chks.length; i++) {
                    if (chks[i].checked) {
                        //hasChecked = true;
                        //break;
                        NoOfChecks++
                    }
                }

                //alert(NoOfChecks);
                if (NoOfChecks < minCheck) {
                    alert("Please select at least one package!");
                    retValue = false;
                }
                return retValue;
            }

            IncreaseProgress(95);

            var maxBoxes = 4;
            var boxesChecked = 0;

            function checkMaxBox(theBox, id) {

                if (boxesChecked + 1 > maxBoxes) {
                    alert("You have selected 4 packages!");
                    ShowPopupLearnMore();
                    return false;
                }
                boxesChecked++
                if (document.getElementById(id).checked == true) {
                    //var prefid = id.replace(/cbHLSelect/, "");
                    //document.getElementById(prefid + 'divcbHomeLoan').className = 'colchk_2_checked';
                    //document.getElementById(prefid + 'divcbHomeLoan').onmouseover = '';
                    //document.getElementById(prefid + 'divcbHomeLoan').onmouseout = '';

                }
                return true;
            }

            function unCheckBox(id) {

                //var prefid = id.replace(/cbHLSelect/, "");

                //document.getElementById(prefid + 'divcbHomeLoan').className = '';
                //document.getElementById(prefid + 'divcbHomeLoan').onmouseover = function onmouseover(event) { this.className = "colchk_2_selected"; }
                //document.getElementById(prefid + 'divcbHomeLoan').onmouseout = function onmouseover(event) { this.className = "colchk_2"; }

            }




            function HidePanelLearnMore() {
                document.getElementById('<%=pnlPopup.ClientID%>').style.display = 'none';

                var modpop = $find("mdlPopupLearnMore");
                if (!modpop) { return; }
                modpop.hide();

            }

            function ShowPopupLearnMore() {
                //alert("pop up");
                var modpop = $find("mdlPopupLearnMore");
                //alert(modpop);
                if (!modpop) { return; }
                modpop.show();
            }

            IncreaseProgress(100);
            HideLoading();
        
        </script>
</asp:Content>
